<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta charset="utf-8" />
    <title>班级预设</title>

    <meta name="description" content="Static &amp; Dynamic Tables" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

    <link rel="stylesheet" href="${ctx}/css/bootstrap.min.css" />
    <link rel="stylesheet" href="${ctx}/css/font-awesome.min.css" />
   <link rel="stylesheet"   href=" ${ctx}/css/pagination.css" />

    <link rel="stylesheet" href="${ctx}/css/ace-fonts.css" />

    <link rel="stylesheet" href="${ctx}/css/ace.min.css" id="main-ace-style" />

    <link rel="stylesheet" href="${ctx}/css/ace-skins.min.css" />
    <link rel="stylesheet" href="${ctx}/css/ace-rtl.min.css" />
    <link rel="stylesheet" href="${ctx}/css/toastr.css" />
    <link rel="stylesheet" href="${ctx}/css/default.css" />
     <link rel="stylesheet" href="${ctx}/css/default.date.css" />
</head>

<body class="no-skin" ng-controller="kClass">
<!-- #section:basics/navbar.layout -->
<div id="navbar" class="navbar navbar-default">

    <script type="text/javascript">
        try{ace.settings.check('navbar' , 'fixed')}catch(e){}
    </script>

    <div class="navbar-container" id="navbar-container">
        <!-- #section:basics/sidebar.mobile.toggle -->
        <button type="button" class="navbar-toggle menu-toggler pull-left" id="menu-toggler">
            <span class="sr-only">Toggle sidebar</span>

            <span class="icon-bar"></span>

            <span class="icon-bar"></span>

            <span class="icon-bar"></span>
        </button>

        <!-- /section:basics/sidebar.mobile.toggle -->
        <div class="navbar-header pull-left">
            <!-- #section:basics/navbar.layout.brand -->
            <a href="#" class="navbar-brand">
                <small>
                    <i class="fa fa-leaf"></i>
                    小黄莺艺术学校 | Admin
                </small>
            </a>

            <!-- /section:basics/navbar.layout.brand -->

            <!-- #section:basics/navbar.toggle -->

            <!-- /section:basics/navbar.toggle -->
        </div>

        <!-- #section:basics/navbar.dropdown -->
        <div class="navbar-buttons navbar-header pull-right" role="navigation">
            <ul class="nav ace-nav">

                <li class="green">
                    <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                        <i class="ace-icon fa fa-envelope icon-animated-vertical"></i>
                    </a>
                </li>

                <!-- #section:basics/navbar.user_menu -->
                <li class="light-blue">
                    <a data-toggle="dropdown" href="#" class="dropdown-toggle">
                        <img class="nav-user-photo" src="${ctx}/assets/avatars/user.jpg" alt="Jason's Photo" />
								<span class="user-info">
									<small>Welcome,</small>
									admin
								</span>

                        <i class="ace-icon fa fa-caret-down"></i>
                    </a>

                    <ul class="user-menu dropdown-menu-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
                        <li>
                            <a href="#">
                                <i class="ace-icon fa fa-cog"></i>
                                Settings
                            </a>
                        </li>

                        <li class="divider"></li>

                        <li>
                            <a href="${ctx}/admin/logout">
                                <i class="ace-icon fa fa-power-off"></i>
                                Logout
                            </a>
                        </li>
                    </ul>
                </li>

                <!-- /section:basics/navbar.user_menu -->
            </ul>
        </div>

        <!-- /section:basics/navbar.dropdown -->
    </div><!-- /.navbar-container -->
</div>

<!-- /section:basics/navbar.layout -->
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try{ace.settings.check('main-container' , 'fixed')}catch(e){}
    </script>

    <!-- #section:basics/sidebar -->
    <div id="sidebar" class="sidebar responsive">
        <script type="text/javascript">
            try{ace.settings.check('sidebar' , 'fixed')}catch(e){}
        </script>

        <div class="sidebar-shortcuts" id="sidebar-shortcuts">
            <div class="sidebar-shortcuts-large" id="sidebar-shortcuts-large">
                <button class="btn btn-success">
                    <i class="ace-icon fa fa-signal"></i>
                </button>

                <button class="btn btn-info">
                    <i class="ace-icon fa fa-pencil"></i>
                </button>

                <!-- #section:basics/sidebar.layout.shortcuts -->
                <button class="btn btn-warning">
                    <i class="ace-icon fa fa-users"></i>
                </button>

                <button class="btn btn-danger">
                    <i class="ace-icon fa fa-cogs"></i>
                </button>

                <!-- /section:basics/sidebar.layout.shortcuts -->
            </div>

            <div class="sidebar-shortcuts-mini" id="sidebar-shortcuts-mini">
                <span class="btn btn-success"></span>

                <span class="btn btn-info"></span>

                <span class="btn btn-warning"></span>

                <span class="btn btn-danger"></span>
            </div>
        </div><!-- /.sidebar-shortcuts -->

        <ul class="nav nav-list">

            <li class="active open">
                <a href="#" class="dropdown-toggle">
                    <i class="menu-icon fa fa-list"></i>
                    <span class="menu-text"> 系统管理员 </span>

                    <b class="arrow fa fa-angle-down"></b>
                </a>

                <b class="arrow"></b>

                <ul class="submenu">
                    <li class="active">
                        <a href="${ctx}/admin/classPreset">
                            <i class="menu-icon fa fa-caret-right"></i>
                            班级预设
                        </a>
                    </li>
                    <li>
                        <a href="${ctx}/admin/courseApproval">
                            <i class="menu-icon fa fa-caret-right"></i>
                            课程审定
                        </a>
                    </li>
                </ul>
            </li>
              <li >
                <a href="#" class="dropdown-toggle">
                    <i class="menu-icon fa fa-list"></i>
                    <span class="menu-text"> 数据管理 </span>

                    <b class="arrow fa fa-angle-down"></b>
                </a>

                <b class="arrow"></b>

              <ul class="submenu">
                    <li >
                        <a href="${ctx}/admin/dataStudent">
                            <i class="menu-icon fa fa-caret-right"></i>
                            幼儿数据管理
                        </a>
                    </li>
                    <li>
                        <a href="${ctx}/admin/dataTeacher">
                            <i class="menu-icon fa fa-caret-right"></i>
                            教师数据管理
                        </a>
                    </li>
                  <!--   <li >
                        <a href="${ctx}/admin/dataClass">
                            <i class="menu-icon fa fa-caret-right"></i>
                            班级数据管理
                        </a>
                    </li> -->
                </ul>
            </li>
        </ul><!-- /.nav-list -->

        <!-- #section:basics/sidebar.layout.minimize -->
        <div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
            <i class="ace-icon fa fa-angle-double-left" data-icon1="ace-icon fa fa-angle-double-left" data-icon2="ace-icon fa fa-angle-double-right"></i>
        </div>

        <!-- /section:basics/sidebar.layout.minimize -->
        <script type="text/javascript">
            try{ace.settings.check('sidebar' , 'collapsed')}catch(e){}
        </script>
    </div>

    <!-- /section:basics/sidebar -->
    <div class="main-content">
        <!-- #section:basics/content.breadcrumbs -->
        <div class="breadcrumbs" id="breadcrumbs">
            <script type="text/javascript">
                try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
            </script>

            <ul class="breadcrumb">
                <li >
                    <i class="ace-icon fa fa-home home-icon"></i>
                    <a href="#">系统管理员</a>
                </li>
                <li class="active">班级预设</li>  
            </ul><!-- /.breadcrumb -->

                    
            <!-- #section:basics/content.searchbox -->
            <div class="nav-search" id="nav-search">
                <form class="form-search">
							<span class="input-icon">
								<input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
								<i class="ace-icon fa fa-search nav-search-icon"></i>
							</span>
                </form>
            </div><!-- /.nav-search -->

            <!-- /section:basics/content.searchbox -->
        </div>

        <div class="ace-settings-container" id="ace-settings-container">
            <a href="#addKGrade" role="button" class="green" data-toggle="modal">
                <button class="btn btn-info">添加班级</button>
            </a>
        </div>

        <!-- /section:basics/content.breadcrumbs -->
        <div class="page-content">
            <!-- /section:settings.box -->
            <div class="page-content-area">
                <div class="page-header">
                    <h1>
                        <i class="ace-icon fa fa-angle-double-right"></i>
                        <i class="ace-icon fa fa-angle-double-right"></i>
                        <i class="ace-icon fa fa-angle-double-right"></i>
                        班级预设
                    </h1>
                </div><!-- /.page-header -->

                <div class="row">
                    <div class="col-xs-12">
                        <!-- <div class="table-responsive"> -->

                        <!-- <div class="dataTables_borderWrap"> -->
                        <div>
                            <table id="sample-table-2" class="table table-striped table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th>班级</th>
                                    <th>课程</th>
                                    <th><i class="ace-icon fa fa-clock-o bigger-110 hidden-480"></i>开班时间</th>
                                    <th>任课教师</th>
                                    <th class="hidden-480">人数限制</th>
                                    <th class="hidden-480">费用</th>
                                    <th></th>
                                </tr>
                                </thead>

                                <tbody>
                                <tr ng-repeat="kGradeDTO in kGradeDTOList">
                                    <td ng-bind="kGradeDTO.gName"></td>
                                    <td ng-bind="kGradeDTO.cName"></td>
                                    <td>
                                    	<span ng-bind="(kGradeDTO.gState==0)?'未开班':kGradeDTO.begintTime"></span>
                                    	<span ng-bind="(kGradeDTO.gState==0)?'':'-- '+kGradeDTO.endTime"></span>
                                    </td>
                                    <td ng-bind="kGradeDTO.tUsername"></td>
                                    <td ng-bind="kGradeDTO.gNumber"></td>
                                    <td class="hidden-480">
                                    	<span ng-bind="kGradeDTO.gExpress | currency:'￥'"></span>
                                       
                                    </td>
                                    <td>
                                        <div class="hidden-sm hidden-xs action-buttons">
                                            <a class="green" href="#">
                                                <a href="#modal-table" role="button" class="green"  ng-click="changeInint($index)"  data-toggle="modal" >
                                                    <i class="ace-icon fa fa-pencil bigger-130"></i>
                                                </a>
                                            </a>
                                            <a class="red" href="#">
                                                <a href="javascript:void(0);" ng-click="deleteKGrade(kGradeDTO.gId,kGradeDTO.gState)">
                                                    <i class="ace-icon fa fa-trash-o bigger-130"></i>
                                                </a>
                                            </a>
                                          <div ng-if="kGradeDTO.gState==0"   style="display:inline">
                                            <a class="red" href="#"  >
                                                  <a href="#changeState" role="button" class="red"  ng-click="changeInint($index)"  data-toggle="modal" >
                                                <i class="ace-icon fa fa-check-square-o bigger-130"></i>
                                                </a>
                                            </a>
                                           </div>
                                        </div>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>

          <div class="row">
                   <div  class="col-xs-6">
                            <div id="Pagination" class="pagination"  style="padding-left:50%"><!-- 这里显示分页 --></div>
                   </div>
               </div>
				<!-- 添加课程 -->
                <div id="addKGrade" class="modal fade" tabindex="-1"  width=600px> 
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header no-padding">
                                <div class="table-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                        <span class="white">&times;</span>
                                    </button>
                                    	班级预设
                                </div>
                            </div>
                            <div class="modal-body no-padding">
                                <table class="table table-striped table-bordered table-hover no-margin-bottom no-border-top">
                                    <thead>
                                    <tr>
                                        <th>班级</th>
                                    	<th>课程</th>
                                   
                                    	<th>任课教师</th>
                                    	<th class="hidden-480">人数限制</th>
                                    	<th class="hidden-480">费用（￥）</th>
                                    </tr>
                                    </thead>
                                    <tbody>
	                                    <tr>
	                                        <td><input class="input-small" ng-model="kGrade.gName"  /></td>
	                                        <td>
	                                        	<select ng-model="kGrade.gClassid" ng-options="kClass.name for kClass in kClassList"></select>
	                                        </td>
	                                     
	                                        <td>
	                                        <select ng-model="kGrade.gTeacherid"  ng-options="kTeacher.tusername for kTeacher in kTeacherList"></select>
	                                        </td>
	                                        <td><input ng-model="kGrade.gNumber" class="input-small" value="45"/></td>
	                                        <td><input ng-model="kGrade.gExpress" class="input-small" value=""/></td>
	                                    </tr>
                                    </tbody>
                                </table>
                            </div>

                            <div class="modal-footer no-margin-top">
                                <button class="btn btn-sm btn-success"  data-dismiss="modal" ng-click="addKGrade()">
                                    <i class="ace-icon fa fa-floppy-o bigger-160"></i>
                                   	 保存
                                </button>
                            </div>             
                        </div><!-- /.modal-content -->
                    </div><!-- /.modal-dialog -->
                </div><!-- PAGE CONTENT ENDS -->
                        
         <div id="modal-table" class="modal fade" tabindex="-1">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header no-padding">
                                <div class="table-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                        <span class="white">&times;</span>
                                    </button>
                                   信 息 修 改
                                </div>
                            </div>

                            <div class="modal-body no-padding">
                                <table class="table table-striped table-bordered table-hover no-margin-bottom no-border-top">
                                    <thead>
                                    <tr>
                                        <th>班级名称</th>
                                        <th>费用</th>
                                        <th>人数限制</th>
                                    </tr>
                                    </thead>

                                    <tbody  id="chbody">
                                    <tr  ng-model="gid">
                                        <td><input  type="text"  class="input-small"  ng-model="gName" /></td>
                                        <td><input   class="input-small"  type="text" ng-model="gExpress"/></td>
                                        <td><input  class="input-small" type="text"  ng-model="gNumber"/></td>
                                    </tr>

                                    </tbody>
                                </table>
                            </div>

                            <div class="modal-footer no-margin-top">
                                <button class="btn btn-sm btn-success" data-dismiss="modal"  ng-click="changeKgrade()">
                                    <i class="ace-icon fa fa-floppy-o bigger-160"></i>
                                    保存
                                </button>
                            </div>
                        </div><!-- /.modal-content -->
                    </div><!-- /.modal-dialog -->
                </div><!-- PAGE CONTENT ENDS -->
                
                
                  <div id="changeState"  class="modal fade" tabindex="-1">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header no-padding">
                                <div class="table-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                        <span class="white">&times;</span>
                                    </button>
                                    	设置开班起止时间
                                </div>
                            </div>
                            <div class="modal-body no-padding">
                                <table class="table table-striped table-bordered table-hover no-margin-bottom no-border-top">
                                    <thead>
                                    <tr>
                                        <th>开始时间</th>
                                   
                                    	<th><i class="ace-icon fa fa-clock-o bigger-110 hidden-480"></i>结束时间</th>
                                    	
                                    </tr>
                                    </thead>
                                    <tbody>
	                                    <tr   class="iptgroup">
	                                       <td> 
	                                        <input
                    id="input_01"
                    class="datepicker1"
                    name="date"
                    type="text"
                    autofocuss
                    value="1 June, 2016"
                    data-valuee="2016-06-01"></td>
	                                        <td>               
	                                         <input
                    id="input_02"
                    class="datepicker2"
                    name="date"
                    type="text"
                    autofocuss
                    value="1 June, 2016"
                    data-valuee="2016-06-01"></td>
	                                    </tr>
                                    </tbody>
                                </table>
                            </div>

                            <div class="modal-footer no-margin-top">
                                <button class="btn btn-sm btn-success" data-dismiss="modal"  ng-click="openGrade()">
                                    <i class="ace-icon fa fa-floppy-o bigger-160"></i>
                                   	 保存并开班
                                </button>
                            </div>             
                        </div><!-- /.modal-content -->
                    </div><!-- /.modal-dialog -->
                </div><!-- PAGE CONTENT ENDS -->
                
                
                
            </div><!-- /.page-content-area -->
        </div><!-- /.page-content -->
    </div><!-- /.main-content -->
  <div id="container"></div>
    <div class="footer">
        <div class="footer-inner">
            <!-- #section:basics/footer -->
            <div class="footer-content">
						<span class="bigger-120">
							<span class="blue bolder">KID</span>
							Education &copy; 2016
						</span>
            </div>

            <!-- /section:basics/footer -->
        </div>
    </div>

    <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
        <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
    </a>
</div><!-- /.main-container -->

<!-- basic scripts -->

<!--[if !IE]> -->
<script type="text/javascript">
    window.jQuery || document.write("<script src='${ctx}/js/jquery.min.js'>"+"<"+"/script>");
</script>

<!-- <![endif]-->

<!--[if IE]>
<script type="text/javascript">
    window.jQuery || document.write("<script src='../js/jquery1x.min.js'>"+"<"+"/script>");
</script>
<![endif]-->
<script type="text/javascript">
    if('ontouchstart' in document.documentElement) document.write("<script src='${ctx}/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
</script>

<script src="${ctx}/js/jquery.1.7.0.js"></script>
<script src="${ctx}/js/doubleDate2.0.js"></script>
<script src="${ctx}/js/bootstrap.min.js"></script>
<script src="${ctx}/js/ace-elements.min.js"></script>
<script src="${ctx}/js/ace.min.js"></script>
<script src="${ctx}/js/angular.min.js"></script>
<script src="${ctx}/js/toastr.js"></script>
<script src="${ctx}/js/picker.js"></script><script src="${ctx}/js/picker.date.js"></script>
<script src="${ctx}/js/legacy.js"></script>
<script src="${ctx}/js/jquery.pagination.js"></script>

<!-- inline scripts related to this page -->

<!-- the following scripts are used in demo only for onpage help and you don't need them -->

 <script type="text/javascript">
 var $input1 = $( '.datepicker1' ).pickadate({
     formatSubmit: 'yyyy/mm/dd',
     // min: [2015, 7, 14],
     container: '#container',
     // editable: true,
     closeOnSelect: true,
     closeOnClear: false,
 });

 var picker1 = $input1.pickadate('picker');
 
 var $input2 = $( '.datepicker2' ).pickadate({
     formatSubmit: 'yyyy/mm/dd',
     // min: [2015, 7, 14],
     container: '#container',
     // editable: true,
     closeOnSelect: true,
     closeOnClear: false,
 });

 var picke2r = $input2.pickadate('picker');
      
     </script>

<script>
	var m = angular.module('myApp', []);
	m.controller('kClass', ['$scope', '$http', function($scope, $http){
		$scope.callback=1;
		$scope.total=0;
		$scope.pageNo=1;
		$scope.gid=1;
		/* 新增班级 */
		$scope.addKGrade = function(){
			//data-dismiss="modal"
		//	$scope.kGrade.gClassid =  $scope.kClass.cId;
			$scope.kGrade.gClassid=$scope.kGrade.gClassid.id;
			$scope.kGrade.gTeacherid=$scope.kGrade.gTeacherid.tid;
			$http({
		          url:'../KGradeAction!addKGrade',
		          method:'post',
		          data:$.param(
		          {
		        	   'tbGrade.gname' : $scope.kGrade.gName,
			            'tbGrade.gnumber' : $scope.kGrade.gNumber,
		        		'tbGrade.gexpress' : $scope.kGrade.gExpress,
		        		'tbGrade.gteacherid' : $scope.kGrade.gTeacherid,
		        		'tbGrade.gclassid' : $scope.kGrade.gClassid,
		        		
		          }),
			   headers: {
                   'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
               }
		        }).success(function(data, status, headers, config){
		        	$scope.selectkGradeList();
		        	$scope.kClass = {};
		        	toastr.success("新增成功！");
		        }).error(function(data, status, headers, config){
		          //处理响应失败
		        	   toastr.error("500:服务器错误！");
		        });
		//console.log($scope.kGrade);
			
		};
		/* 初始化修改的模态框 */
		$scope.changeInint = function(index){
			$scope.kGradeDTO =  $scope.kGradeDTOList[index];
		 if($scope.kGradeDTO.gState==1){
			 toastr.info("已开班不允许修改");
			 var div1 = document.getElementById("chbody");
			 var inputs = div1.getElementsByTagName("INPUT");
			 for(var i=0;i<inputs.length;i++){
				 if(inputs[i].type="text"){
					 inputs[i].readOnly=true;
				 } 
			 }
		 }
		    $scope.gid = $scope.kGradeDTO.gId;
			$scope.gName   = $scope.kGradeDTO.gName;
			$scope.gExpress = $scope.kGradeDTO.gExpress;
			$scope.gNumber = $scope.kGradeDTO.gNumber; 
		
		};
		/*修改班级信息*/
		$scope.changeKgrade= function(){
			
			$http({
		          url:'../KGradeAction!updateGrade',
		          method:'post',
		          params:
		          {
		        	'tbGrade.gid' :  $scope.gid,
		            'tbGrade.gname' : $scope.gName,
		            'tbGrade.gnumber' : $scope.gNumber,
	        		'tbGrade.gexpress' : $scope.gExpress,    	
	        	
		          }
		        }).success(function(data, status, headers, config){
		        	$scope.selectkGradeList();
		        	$scope.kClass = {};
		        	toastr.success("修改成功！");
		        }).error(function(data, status, headers, config){
		          //处理响应失败
		        	   toastr.error("500:服务器错误！");
		        });
		};
		/*开班并设置时间*/
		$scope.openGrade= function(){
		
			
			 var begintime= $("#input_01").val();
			 var endtime=$("#input_02").val();
			 var begin=new Date(begintime);
			 var end=new Date(endtime);
			 var month= begin.getMonth()+0+1;
			var endmonth= end.getMonth()+0+1;
			 begin= begin.getFullYear()+"-"+month+"-"+	 begin.getDate();
			 end= end.getFullYear()+"-"+endmonth+"-"+	 end.getDate();
		$http({
				   url:'../KGradeAction!updateGrade',
		          method:'post',
		          
		          params:
		          {
		        	 'tbGrade.gid' : $scope.gid,
		             'tbGrade.gbeginttime' : begin,
		              'tbGrade.gendtime': end, 	
		          }
		        }).success(function(data, status, headers, config){
		        	$scope.selectkGradeList();
		        	$scope.kClass = {};
		        	toastr.success("开课成功！");
		        }).error(function(data, status, headers, config){
		          //处理响应失败
		          toastr.error("500:服务器错误！");
		        }); 
		};
		/* 删除班级 */
		$scope.deleteKGrade = function(gId,gstate){
			if(gstate==1)
				toastr.info("已开班不能删除！");
			else
				{
			$http({
		          url:'../KGradeAction!deletekGradeList',
		          method:'POST',
		          params:
		          {
		            'gradeId' : gId
		          }
		        }).success(function(data, status, headers, config){
		        	console.log(data.gradeId);
		        }).error(function(data, status, headers, config){
		          //处理响应失败
		          	toastr.error("500:服务器错误！");
		    });
				}
		};
		
		/* 查看班级列表 */
		$scope.selectkGradeList = function (){
			$http({
		          url:'../KGradeAction!selectkGradeList',
		          method:'POST',
		          params:
		          {
		            'pageNo' : $scope.pageNo
		          } 
		        }).success(function(data, status, headers, config){
		           if($scope.total==0)
		        	   {
		        	    $scope.total=data.paginationKGradeDTO.totalPage;
		        		$scope.initPagination();
		        	   }
		        	$scope.page = {
		        			'prePage' : data.paginationKGradeDTO.prePage,
		        			'nextPage' : data.paginationKGradeDTO.nextPage,
		        			'totalPage' : data.paginationKGradeDTO.totalPage,
		        	};
		        	$scope.kGradeDTOList = data.paginationKGradeDTO.list;
		        	$scope.kClassList = data.kClassList;
		        	$scope.kTeacherList=data.kTeacherList;
		        }).error(function(data, status, headers, config){
		          //处理响应失败
		        	   toastr.error("500:服务器错误！");
		        });
		};
		/*  */
		
		$scope.init = function (){
			$scope.selectkGradeList();
		}();		 
		$scope.initPagination=function() {
			$("#Pagination").pagination($scope.total, {
				num_edge_entries: 1, //边缘页数
				num_display_entries: 4, //主体页数
				callback: $scope.pageselectCallback,
				items_per_page: 1, //每页显示1项
				prev_text: "前一页",
				next_text: "后一页"
			});
		 };
	$scope.pageselectCallback=function(page_index, jq){
		           page_index+=1;    
		             $scope. pageNo=page_index;
		        	 ($scope.callback==1)? $scope.callback=0:$scope.selectkGradeList();
				return false;
			};
	}]);
</script>
</body>
</html>
